package com.quanquan.store.entity;

import lombok.Data;

import javax.persistence.*;

/**
 * 功能描述:秒杀交易记录
 *
 * @ClassName: ShoppingKillTradingRecord
 * @Author: xiaoqianh丶
 * @Date: 2019-07-01 14:34
 * @Version: V1.0
 */
@Data
@Entity
@Table(name = "oo_shoppingkill_trading_record")
public class ShoppingKillTradingRecord {

    @Id
    @Column(name = "id", unique = true, length = 64)
    private String id;

    /**
     * 用户id
     */
    @Column(name = "use_id", nullable = false, length = 32)
    private String useId;

    /**
     * 秒杀商品id
     */
    @Column(name = "shopping_kill_id", nullable = false, length = 32)
    private String shoppingKillId;

    /**
     *支付类型  integral 积分  money 现金 combination 组合支付
     **/
    @Column(name = "pay_type",length = 64)
    private String payType;

    /**
     * 商品id
     */
    @Column(name = "good_id", nullable = false, length = 32)
    private String goodId;


    /**
     * 商品类型
     */
    @Column(name = "goods_type", nullable = false, length = 32)
    private String goodsType;

    /**
     * 支付价格
     */
    @Column(name = "price",  columnDefinition = "DOUBLE")
    private Double price;

    @Column(name = "integral",  columnDefinition = "INT")
    private Integer integral;
    /**
     * 订单号
     */
    @Column(name = "order_number", nullable = false, length = 32)
    private String orderNumber;
    /**
     * 创建时间
     */

    @Column(name = "create_time", nullable = false, length = 32)
    private String createTime;

    /**
     * 申请状态
     */
    @Column(name = "trading_status",length = 32)
    @Enumerated(EnumType.STRING)
    private ShoppingKillTradingRecord.TradingStatus tradingStatus;

    public enum TradingStatus {
        /**
         * 待支付  已支付 已失效（过期）
         */
        unpaid, paid ,overdue
    }

    /**
     * 微信支付单号
     */
    @Column(name = "transaction_id",length = 32)
    private String transactionId;


    /**
     * 支付时间
     **/
    @Column(name = "payTime",length = 32)
    private String payTime;


    /**
     * 秒杀商品分面
     */
    @Transient
    private String coverImg;

    /**
     * 秒杀商品名字
     */
    @Transient
    private String shoppingKillName;

}
